import {resolveComponent} from "vue";
import { $menuUtils } from '@jzl/utils'
import { COMMON_PAGE_ROUTES } from '@jzl/comps'
import {Page404} from "@jzl/comps";

const routes = [
  /*{
    name: 'index',
    path: 'index',
    meta: {
      title: '欢迎页'
    },
    component: () => import('../views/home.vue')
  }, {
    name: 'login',
    path: 'login',
    meta: {
      title: '登录'
    },
    component: () => import('../views/login.vue')
  }, {
    name: 'idemo',
    path: 'demo',
    meta: {
      title: 'demo'
    },
    component: () => import('../views/demo.vue')
  }, */{
    name: 'basic-role',
    path: 'basic/role',
    meta: {
      title: '角色管理'
    },
    component: () => import('../views/basic/role/role.vue')
  }, {
    name: 'basic-admin',
    path: 'basic/admin',
    meta: {
      title: '管理员管理'
    },
    component: () => import('../views/basic/admin/admin.vue')
  }/*, {
    name: 'basic-profile',
    path: 'basic/profile',
    meta: {
      title: '个人信息'
    },
    component: () => import('../views/basic/profile/profile.vue'),
  }*/, {
    name: 'basic-tenant-profile',
    path: 'basic/tenant-profile',
    meta: {
      title: '租户信息'
    },
    component: () => import('../views/basic/tenant/profile.vue'),
  }, {
    name: 'basic-project-profile',
    path: 'basic/project-profile',
    meta: {
      title: '租户信息'
    },
    component: () => import('../views/basic/tenant/profile.vue'),
  }, {
    name: 'basic-mb',
    path: 'basic/mb',
    meta: {
      title: '码表信息'
    },
    component: () => import('../views/basic/mb/mb.vue'),
  }, {
    name: 'basic-dept',
    path: 'basic/dept',
    meta: {
      title: '部门管理'
    },
    component: () => import('../views/basic/dept/dept.vue'),
  }, {
    name: 'basic-dept-matrix',
    path: 'basic/dept-matrix',
    meta: {
      title: '部门矩阵'
    },
    component: () => import('../views/basic/dept/dept-matrix.vue'),
  }, {
    name: 'basic-menus',
    path: 'basic/menus',
    meta: {
      title: '菜单管理'
    },
    component: () => import('../views/basic/menus/menus.vue'),
  }, {
    name: 'basic-parameter',
    path: 'basic/parameter',
    meta: {
      title: '系统配置'
    },
    component: () => import('../views/basic/config/parameter.vue'),
  }, {
    name: 'basic-whiteapi',
    path: 'basic/whiteapi',
    meta: {
      title: '白名单'
    },
    component: () => import('../views/basic/config/whiteapi.vue'),
  }, {
    name: 'basic-msgtpl',
    path: 'basic/msgtpl',
    meta: {
      title: '消息模板'
    },
    component: () => import('../views/basic/config/msgtpl.vue'),
  }, {
    name: 'basic-services',
    path: 'basic/services',
    component: () => import('../views/basic/services/services.vue'),
  }, {
    name: 'basic-plat-services',
    path: 'basic/plat-services',
    component: () => import('../views/basic/services/svc-plat-apis.vue'),
  }, {
    name: 'basic-funcs',
    path: 'basic/funcs',
    component: () => import('../views/basic/func/funcs.vue'),
  }, {
    name: 'basic-tasks',
    path: 'basic/tasks',
    component: () => import('../views/basic/task/tasks.vue'),
  }, {
    name: 'basic-hooks',
    path: 'basic/hooks',
    component: () => import('../views/basic/hook/hooks.vue'),
  }, {
    name: 'basic-order',
    path: 'basic/order',
    component: () => import('../views/basic/order/order-tasks.vue'),
  }, {
    name: 'basic-forms',
    path: 'basic/forms',
    component: () => import('../views/basic/form/list.vue'),
  }, {
    name: 'basic-pages',
    path: 'basic/pages',
    component: () => import('../views/basic/pages/pages.vue'),
  }, {
    name: 'basic-comps',
    path: 'basic/comps',
    component: () => import('../views/basic/comps/list.vue'),
  }, {
    name: 'portal-apps',
    path: 'portal/apps',
    meta: {
      title: '应用管理',
      singleton: true // 单例模式，在tabs 中通过名称判断是否唯一，而不是路径，与 isHidden 配置使用，隐藏子路由
    },
    component: () => import('../views/app/apps.vue'),
    children: [{
      name: 'portal-app-detail',
      path: 'app-:appId/app-detail',
      meta: { title: '应用信息', isHidden: true },
      component: () => import('../views/app/modules/app-detail.vue')
    }, {
      name: 'portal-app-form',
      path: 'app-:appId/form',
      meta: { title: '应用表单', isHidden: true },
      component: () => import('../views/app/portal-form.vue'),
    }, {
      name: 'portal-app-menu',
      path: 'app-:appId/menu',
      meta: { title: '应用菜单', isHidden: true },
      component: () => import('../views/app/portal-menu.vue'),
    }, {
      name: 'portal-app-page',
      path: 'app-:appId/page',
      meta: { title: '应用菜单', isHidden: true },
      component: () => import('../views/app/portal-page.vue'),
    }, {
      name: 'portal-app-mb',
      path: 'app-:appId/mb',
      meta: { title: '码表', isHidden: true },
      component: () => import('../views/app/portal-mb.vue'),
    }, {
      name: 'portal-app-dcomp',
      path: 'app-:appId/dcomp',
      meta: { title: '组件', isHidden: true },
      component: () => import('../views/app/portal-dcomp.vue'),
    }, {
      name: 'portal-app-report',
      path: 'app-:appId/report',
      meta: { title: '报表', isHidden: true },
      component: () => import('../views/app/portal-report.vue'),
    }, {
      name: 'portal-app-microsvc',
      path: 'app-:appId/microsvc',
      meta: { title: '微服务', isHidden: true },
      component: () => import('../views/app/portal-microsvc.vue'),
    }, {
      name: 'portal-app-func',
      path: 'app-:appId/func',
      meta: { title: '云函数', isHidden: true },
      component: () => import('../views/app/portal-func.vue'),
    }, {
      name: 'portal-app-task',
      path: 'app-:appId/task',
      meta: { title: '任务', isHidden: true },
      component: () => import('../views/app/portal-task.vue'),
    }, {
      name: 'portal-app-hook',
      path: 'app-:appId/hook',
      meta: { title: '切面编程', isHidden: true },
      component: () => import('../views/app/portal-hook.vue'),
    }]
  } /*, {
    name: 'portal-app',
    path: 'portal/app-:appId',
    meta: { title: '应用中心' },
    component: () => import('../views/app/app-layout.vue'),
    // redirect: 'portal-app-detail',

  }, {
    name: 'portal-form-create-type',
    path: 'portal/form/create-type',
    component: (resolve) => require(['../views/form/create-sel-type'], resolve),
  }, {
    name: 'portal-form-create',
    path: 'portal/form/create',
    component: (resolve) => require(['../views/form/create'], resolve),
  }*/, {
    path: '/:catchAll(.*)',
    component: Page404
  },

  // 暂不使用功能，临时关闭
  /*, {
    name: 'basic-reg-audit',
    path: 'basic/reg-audit',
    meta: {
      title: '管理员管理'
    },
    component: (resolve) => require(['../views/basic/admin/reg-audit'], resolve),
  }, {
    name: 'basic-quotes',
    path: 'basic/quotes',
    meta: {
      title: '书签设置'
    },
    component: (resolve) => require(['../views/basic/quotes/list'], resolve),
  }/*, {
    name: 'basic-message',
    path: 'basic/message',
    meta: {
      title: '消息信息'
    },
    component: (resolve) => require(['../views/basic/message/list'], resolve),
  }, {
    name: 'basic-tag',
    path: 'basic/tag',
    component: (resolve) => require(['../views/basic/tag/list'], resolve),
  }/*, {
    name: 'basic-webpage',
    path: 'basic/webpage',
    component: (resolve) => require(['../views/basic/webpage/pages'], resolve),
  }, {
    name: 'basic-report',
    path: 'basic/report',
    component: (resolve) => require(['../views/basic/report/index'], resolve),
  }, {
    name: 'basic-filespace',
    path: 'basic/filespace',
    component: (resolve) => require(['../views/basic/file/space'], resolve),
  }*/

  // 通用页面，抽出通用组件
  /*{
    path: 'pc-:pageCode-:viewCode',
    name: 'pcPageView',
    component: () => Promise.resolve(resolveComponent('RpPage'))
    // component: RpPage // () => import('../views/demo.vue')
  },
  {
    path: 'pc-:pageCode',
    name: 'pcPage',
    component: () => Promise.resolve(resolveComponent('RpPage'))
    // component: RpPage // () => import('../views/demo.vue')
  },
  {
    path: 'pi-:pageId-:viewId',
    name: 'piPageView',
    component: () => Promise.resolve(resolveComponent('RpPage'))
  },
  {
    path: 'pi-:pageId',
    name: 'piPage',
    component: () => Promise.resolve(resolveComponent('RpPage'))
  },
  // 数据列表
  {
    path: 'flc-:formCode-:viewCode',
    name: 'flcFormView',
    component: () => Promise.resolve(resolveComponent('RpFlist'))
    // component: () => RpFlist
  },
  {
    path: 'flc-:formCode',
    name: 'flcForm',
    component: () => Promise.resolve(resolveComponent('RpFlist'))
    // component: app.component('FpFlist')
    // com
    // ponent: () => RpFlist
    // component: () => import('@jzl/comps')
  },
  {
    path: 'fli-:formId-:viewId',
    name: 'fliFormView',
    component: () => Promise.resolve(resolveComponent('RpFlist'))
    // component: RpFlist  // () => import('../views/demo.vue')
  },
  {
    path: 'fli-:formId',
    name: 'fliForm',
    component: () => Promise.resolve(resolveComponent('RpFlist'))
    // component: RpFlist  // () => import('../views/demo.vue')
  },
  // 数据详情
  {
    path: 'fdc-:formCode-:viewCode-:dataId',
    name: 'fdcFormView',
    component: () => Promise.resolve(resolveComponent('RpFdetail'))
    // component: RpFdetail  // () => import('../views/demo.vue')
  },
  {
    path: 'fdc-:formCode-:dataId',
    name: 'fdcForm',
    component: () => Promise.resolve(resolveComponent('RpFdetail'))
    // component: RpFdetail  // () => import('../views/demo.vue')
  },
  {
    path: 'fdi-:formId-:viewId-:dataId',
    name: 'fdiFormView',
    component: () => Promise.resolve(resolveComponent('RpFdetail'))
    // component: RpFdetail  // () => import('../views/demo.vue')
  },
  {
    path: 'fdi-:formId-:dataId',
    name: 'fdiForm',
    component: () => Promise.resolve(resolveComponent('RpFdetail'))
    // component: RpFdetail  // () => import('../views/demo.vue')
  },
  // 数据新增
  {
    path: 'fac-:formCode-:viewCode-:dataId',
    name: 'fdcFormView',
    component: () => Promise.resolve(resolveComponent('RpFadd'))
    // component: RpFadd  // () => import('../views/demo.vue')
  },
  {
    path: 'fdc-:formCode-:dataId',
    name: 'fdcForm',
    component: () => Promise.resolve(resolveComponent('RpFadd'))
    // component: RpFadd  // () => import('../views/demo.vue')
  },
  {
    path: 'fdi-:formId-:viewId-:dataId',
    name: 'fdiFormView',
    component: () => Promise.resolve(resolveComponent('RpFadd'))
    // component: RpFadd  // () => import('../views/demo.vue')
  },
  {
    path: 'fdi-:formId-:dataId',
    name: 'fdiForm',
    component: () => Promise.resolve(resolveComponent('RpFadd'))
    // component: RpFadd  // () => import('../views/demo.vue')
  },*/
];

export default routes;
